package com.ruoyi.test.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfig {

    @Bean
    public FilterRegistrationBean<Token认证Filter> authenticationFilterRegistration() {
        FilterRegistrationBean<Token认证Filter> registrationBean = new FilterRegistrationBean<>();
        //认证
        registrationBean.setFilter(new Token认证Filter());
        registrationBean.addUrlPatterns("/api/*"); // 设置需要进行身份验证的URL模式
        registrationBean.setOrder(1); // 设置过滤器1的顺序
        return registrationBean;
    }
    @Bean
    public FilterRegistrationBean<黑名单白名单Filter> hmdbmdRegistration() {
        FilterRegistrationBean<黑名单白名单Filter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new 黑名单白名单Filter());
        registrationBean.addUrlPatterns("/api/*"); // 设置需要进行身份验证的URL模式
        registrationBean.setOrder(2); // 设置过滤器2的顺序
        return registrationBean;
    }
    @Bean
    public FilterRegistrationBean<过滤敏感词汇Filter> glmgchRegistration() {
        FilterRegistrationBean<过滤敏感词汇Filter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new 过滤敏感词汇Filter());
        registrationBean.addUrlPatterns("/api/*"); // 设置需要进行身份验证的URL模式
        registrationBean.setOrder(2); // 设置过滤器2的顺序
        return registrationBean;
    }
}